<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RBS::Prototype::RB - rbs: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="Helpers.html">RBS::Prototype::Helpers</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-block_type">#block_type</a>
    <li ><a href="#method-i-body_type">#body_type</a>
    <li ><a href="#method-i-const_to_name">#const_to_name</a>
    <li ><a href="#method-i-const_to_name-21">#const_to_name!</a>
    <li ><a href="#method-i-current_accessibility">#current_accessibility</a>
    <li ><a href="#method-i-decls">#decls</a>
    <li ><a href="#method-i-find_def_index_by_name">#find_def_index_by_name</a>
    <li ><a href="#method-i-function_return_type_from_body">#function_return_type_from_body</a>
    <li ><a href="#method-i-function_type_from_body">#function_type_from_body</a>
    <li ><a href="#method-i-if_unless_type">#if_unless_type</a>
    <li ><a href="#method-i-is_accessibility-3F">#is_accessibility?</a>
    <li ><a href="#method-i-literal_to_symbol">#literal_to_symbol</a>
    <li ><a href="#method-i-literal_to_type">#literal_to_type</a>
    <li ><a href="#method-i-node_type">#node_type</a>
    <li ><a href="#method-i-param_type">#param_type</a>
    <li ><a href="#method-i-parse">#parse</a>
    <li ><a href="#method-i-private">#private</a>
    <li ><a href="#method-i-process">#process</a>
    <li ><a href="#method-i-process_children">#process_children</a>
    <li ><a href="#method-i-public">#public</a>
    <li ><a href="#method-i-range_element_type">#range_element_type</a>
    <li ><a href="#method-i-remove_unnecessary_accessibility_methods-21">#remove_unnecessary_accessibility_methods!</a>
    <li ><a href="#method-i-sort_members-21">#sort_members!</a>
    <li ><a href="#method-i-types_to_union_type">#types_to_union_type</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RBS::Prototype::RB">
    <h1 id="class-RBS::Prototype::RB" class="class">
      class RBS::Prototype::RB
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="Context">Context
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-source_decls" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">source_decls</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-toplevel_members" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">toplevel_members</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-ivar">@source_decls</span> = []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-block_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">block_type</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="block_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 559</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">block_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:BLOCK</span>

  <span class="ruby-identifier">return_stmts</span> = <span class="ruby-identifier">any_node?</span>(<span class="ruby-identifier">node</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">n</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:RETURN</span>
  <span class="ruby-keyword">end</span>&amp;.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">return_node</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">returned_value</span> = <span class="ruby-identifier">return_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-identifier">returned_value</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">returned_value</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Nil</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">end</span> <span class="ruby-operator">||</span> []
  <span class="ruby-identifier">last_node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>
  <span class="ruby-identifier">last_evaluated</span> =  <span class="ruby-identifier">last_node</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">last_node</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Nil</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">types_to_union_type</span>([<span class="ruby-operator">*</span><span class="ruby-identifier">return_stmts</span>, <span class="ruby-identifier">last_evaluated</span>])
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-body_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">body_type</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="body_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 539</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">body_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Nil</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">node</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:IF</span>, <span class="ruby-value">:UNLESS</span>
    <span class="ruby-identifier">if_unless_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:BLOCK</span>
    <span class="ruby-identifier">block_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-const_to_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">const_to_name</span><span
                                class="method-args">(node, context:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="const_to_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 458</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">const_to_name</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">context:</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:SELF</span>
      <span class="ruby-identifier">context</span>.<span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">to_type_name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:CONST</span>, <span class="ruby-value">:COLON2</span>, <span class="ruby-value">:COLON3</span>
      <span class="ruby-identifier">const_to_name!</span>(<span class="ruby-identifier">node</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-const_to_name-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">const_to_name!</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="const_to_name-21-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 439</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">const_to_name!</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:CONST</span>
    <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:COLON2</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
      <span class="ruby-identifier">namespace</span> = <span class="ruby-identifier">const_to_name!</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_namespace</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">namespace</span> = <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>], <span class="ruby-value">namespace:</span> <span class="ruby-identifier">namespace</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:COLON3</span>
    <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">root</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-current_accessibility" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">current_accessibility</span><span
                                class="method-args">(decls, index = decls.size)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="current_accessibility-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 737</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">current_accessibility</span>(<span class="ruby-identifier">decls</span>, <span class="ruby-identifier">index</span> = <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">size</span>)
  <span class="ruby-identifier">slice</span> = <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">index</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>
  <span class="ruby-identifier">idx</span> = <span class="ruby-identifier">slice</span>.<span class="ruby-identifier">rindex</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span> <span class="ruby-identifier">decl</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">private</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">decl</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">public</span> }
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">idx</span>
    <span class="ruby-identifier">_</span> = <span class="ruby-identifier">decls</span>[<span class="ruby-identifier">idx</span>]
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">public</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-decls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">decls</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="decls-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">decls</span>
  <span class="ruby-comment"># @type var decls: Array[AST::Declarations::t]</span>
  <span class="ruby-identifier">decls</span> = []

  <span class="ruby-comment"># @type var top_decls: Array[AST::Declarations::t]</span>
  <span class="ruby-comment"># @type var top_members: Array[AST::Members::t]</span>
  <span class="ruby-identifier">top_decls</span>, <span class="ruby-identifier">top_members</span> = <span class="ruby-identifier">_</span> = <span class="ruby-identifier">source_decls</span>.<span class="ruby-identifier">partition</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>) }

  <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">top_decls</span>)

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">top_members</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">top</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-value">:Object</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>),
      <span class="ruby-value">super_class:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">members:</span> <span class="ruby-identifier">top_members</span>,
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">type_params:</span> []
    )
    <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">top</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">decls</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-find_def_index_by_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_def_index_by_name</span><span
                                class="method-args">(decls, name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="find_def_index_by_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 777</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_def_index_by_name</span>(<span class="ruby-identifier">decls</span>, <span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">index</span> = <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">find_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">decl</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>, <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrReader</span>
      <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrWriter</span>
      <span class="ruby-value">:&quot;#{decl.name}=&quot;</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">index</span>
    [
      <span class="ruby-identifier">index</span>,
      <span class="ruby-identifier">_</span> = <span class="ruby-identifier">decls</span>[<span class="ruby-identifier">index</span>]
    ]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-function_return_type_from_body" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">function_return_type_from_body</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="function_return_type_from_body-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 534</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">function_return_type_from_body</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-identifier">body</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]
  <span class="ruby-identifier">body_type</span>(<span class="ruby-identifier">body</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-function_type_from_body" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">function_type_from_body</span><span
                                class="method-args">(node, def_name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="function_type_from_body-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 478</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">function_type_from_body</span>(<span class="ruby-identifier">node</span>, <span class="ruby-identifier">def_name</span>)
  <span class="ruby-identifier">table_node</span>, <span class="ruby-identifier">args_node</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">_</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>

  <span class="ruby-identifier">pre_num</span>, <span class="ruby-identifier">_pre_init</span>, <span class="ruby-identifier">opt</span>, <span class="ruby-identifier">_first_post</span>, <span class="ruby-identifier">post_num</span>, <span class="ruby-identifier">_post_init</span>, <span class="ruby-identifier">rest</span>, <span class="ruby-identifier">kw</span>, <span class="ruby-identifier">kwrest</span>, <span class="ruby-identifier">_block</span> = <span class="ruby-identifier">args_from_node</span>(<span class="ruby-identifier">args_node</span>)

  <span class="ruby-identifier">return_type</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">def_name</span> <span class="ruby-operator">==</span> <span class="ruby-value">:initialize</span>
                  <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
                <span class="ruby-keyword">else</span>
                  <span class="ruby-identifier">function_return_type_from_body</span>(<span class="ruby-identifier">node</span>)
                <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">fun</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">empty</span>(<span class="ruby-identifier">return_type</span>)

  <span class="ruby-identifier">table_node</span>.<span class="ruby-identifier">take</span>(<span class="ruby-identifier">pre_num</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">required_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">while</span> <span class="ruby-identifier">opt</span>&amp;.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:OPT_ARG</span>
    <span class="ruby-identifier">lvasgn</span>, <span class="ruby-identifier">opt</span> = <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">children</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">lvasgn</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">optional_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
      <span class="ruby-value">type:</span> <span class="ruby-identifier">param_type</span>(<span class="ruby-identifier">lvasgn</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>])
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span>
    <span class="ruby-identifier">rest_name</span> = <span class="ruby-identifier">rest</span> <span class="ruby-operator">==</span> <span class="ruby-value">:*</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">rest</span> <span class="ruby-comment"># # For `def f(...) end` syntax</span>
    <span class="ruby-identifier">fun</span> = <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">rest_positionals:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">rest_name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>))
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">table_node</span>.<span class="ruby-identifier">drop</span>(<span class="ruby-identifier">fun</span>.<span class="ruby-identifier">required_positionals</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">optional_positionals</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">fun</span>.<span class="ruby-identifier">rest_positionals</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)).<span class="ruby-identifier">take</span>(<span class="ruby-identifier">post_num</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">trailing_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">while</span> <span class="ruby-identifier">kw</span>
    <span class="ruby-identifier">lvasgn</span>, <span class="ruby-identifier">kw</span> = <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">children</span>
    <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-identifier">lvasgn</span>.<span class="ruby-identifier">children</span>

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">value</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:NODE_SPECIAL_REQUIRED_KEYWORD</span>
      <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">required_keywords</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractSyntaxTree</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>
      <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">optional_keywords</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">param_type</span>(<span class="ruby-identifier">value</span>))
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unexpected keyword arg value: #{value}&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">kwrest</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">kwrest</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">any?</span>
    <span class="ruby-identifier">fun</span> = <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">rest_keywords:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">kwrest</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>))
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">fun</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-if_unless_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">if_unless_type</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="if_unless_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 552</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">if_unless_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:IF</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:UNLESS</span>

  <span class="ruby-identifier">_exp_node</span>, <span class="ruby-identifier">true_node</span>, <span class="ruby-identifier">false_node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
  <span class="ruby-identifier">types_to_union_type</span>([<span class="ruby-identifier">body_type</span>(<span class="ruby-identifier">true_node</span>), <span class="ruby-identifier">body_type</span>(<span class="ruby-identifier">false_node</span>)])
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-is_accessibility-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">is_accessibility?</span><span
                                class="method-args">(decl)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="is_accessibility-3F-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 773</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_accessibility?</span>(<span class="ruby-identifier">decl</span>)
  <span class="ruby-identifier">decl</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">public</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">decl</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">private</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-literal_to_symbol" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">literal_to_symbol</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="literal_to_symbol-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 469</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">literal_to_symbol</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:LIT</span>
    <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:STR</span>
    <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_sym</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-literal_to_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">literal_to_type</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="literal_to_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 573</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">literal_to_type</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:STR</span>
    <span class="ruby-identifier">lit</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">lit</span>.<span class="ruby-identifier">ascii_only?</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">literal:</span> <span class="ruby-identifier">lit</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">String</span>.<span class="ruby-identifier">instance_type</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:DSTR</span>, <span class="ruby-value">:XSTR</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">String</span>.<span class="ruby-identifier">instance_type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:DSYM</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>.<span class="ruby-identifier">instance_type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:DREGX</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">instance_type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:TRUE</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">literal:</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:FALSE</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">literal:</span> <span class="ruby-keyword">false</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:NIL</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Nil</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:LIT</span>
    <span class="ruby-identifier">lit</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">lit</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">lit</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">ascii_only?</span>
        <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">literal:</span> <span class="ruby-identifier">lit</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>.<span class="ruby-identifier">instance_type</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Integer</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">literal:</span> <span class="ruby-identifier">lit</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">type_name</span> = <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">lit</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">root</span>)
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">type_name</span>, <span class="ruby-value">args:</span> [], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:ZLIST</span>, <span class="ruby-value">:ZARRAY</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">instance_type</span>(<span class="ruby-identifier">untyped</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:LIST</span>, <span class="ruby-value">:ARRAY</span>
    <span class="ruby-identifier">elem_types</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">e</span>) }
    <span class="ruby-identifier">t</span> = <span class="ruby-identifier">types_to_union_type</span>(<span class="ruby-identifier">elem_types</span>)
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">instance_type</span>(<span class="ruby-identifier">t</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:DOT2</span>, <span class="ruby-value">:DOT3</span>
    <span class="ruby-identifier">types</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">c</span>) }
    <span class="ruby-identifier">type</span> = <span class="ruby-identifier">range_element_type</span>(<span class="ruby-identifier">types</span>)
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Range</span>.<span class="ruby-identifier">instance_type</span>(<span class="ruby-identifier">type</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:HASH</span>
    <span class="ruby-identifier">list</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">list</span>
      <span class="ruby-identifier">children</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">children</span>
      <span class="ruby-identifier">children</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">children</span> = []
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">key_types</span> = []
    <span class="ruby-identifier">value_types</span> = []
    <span class="ruby-identifier">children</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">k</span>
        <span class="ruby-identifier">key_types</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">k</span>)
        <span class="ruby-identifier">value_types</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">v</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">key_types</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">untyped</span>
        <span class="ruby-identifier">value_types</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">untyped</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">key_types</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">key_types</span>.<span class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>) }
      <span class="ruby-identifier">fields</span> = <span class="ruby-identifier">key_types</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">literal</span> }.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">value_types</span>).<span class="ruby-identifier">to_h</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Record</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">fields:</span> <span class="ruby-identifier">fields</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">key_type</span> = <span class="ruby-identifier">types_to_union_type</span>(<span class="ruby-identifier">key_types</span>)
      <span class="ruby-identifier">value_type</span> = <span class="ruby-identifier">types_to_union_type</span>(<span class="ruby-identifier">value_types</span>)
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>.<span class="ruby-identifier">instance_type</span>(<span class="ruby-identifier">key_type</span>, <span class="ruby-identifier">value_type</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:SELF</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:CALL</span>
    <span class="ruby-identifier">receiver</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">method_name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:freeze</span>, <span class="ruby-value">:tap</span>, <span class="ruby-value">:itself</span>, <span class="ruby-value">:dup</span>, <span class="ruby-value">:clone</span>, <span class="ruby-value">:taint</span>, <span class="ruby-value">:untaint</span>, <span class="ruby-value">:extend</span>
      <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">receiver</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">untyped</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">untyped</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-node_type" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">node_type</span><span
                                class="method-args">(node, default: Types::Bases::Any.new(location: nil))</span>
                            </div>

                            <div class="method-description">
                              <p>backward compatible</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="RB.html#method-i-param_type">param_type</a>
                            </div>
                          </div>

                  <div id="method-i-param_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">param_type</span><span
                                class="method-args">(node, default: Types::Bases::Any.new(location: nil))</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="param_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 694</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">param_type</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">default:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>))
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:LIT</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>.<span class="ruby-identifier">instance_type</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Integer</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Integer</span>.<span class="ruby-identifier">instance_type</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Float</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Float</span>.<span class="ruby-identifier">instance_type</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">default</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:STR</span>, <span class="ruby-value">:DSTR</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">String</span>.<span class="ruby-identifier">instance_type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:NIL</span>
    <span class="ruby-comment"># This type is technical non-sense, but may help practically.</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Optional</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>
    )
  <span class="ruby-keyword">when</span> <span class="ruby-value">:TRUE</span>, <span class="ruby-value">:FALSE</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Bool</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:ARRAY</span>, <span class="ruby-value">:LIST</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">instance_type</span>(<span class="ruby-identifier">default</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:HASH</span>
    <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>.<span class="ruby-identifier">instance_type</span>(<span class="ruby-identifier">default</span>, <span class="ruby-identifier">default</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">default</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="RB.html#method-i-node_type">node_type</a>
                            </div>

                          </div>

                  <div id="method-i-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(string)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 75</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">string</span>)
  <span class="ruby-comment"># @type var comments: Hash[Integer, AST::Comment]</span>
  <span class="ruby-identifier">comments</span> = <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier">lex</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">yield_self</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tokens</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">code_lines</span> = {}
    <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">each</span>.<span class="ruby-identifier">with_object</span>({}) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">token</span>, <span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">1</span>]
      <span class="ruby-keyword">when</span> <span class="ruby-value">:on_sp</span>, <span class="ruby-value">:on_ignored_nl</span>
        <span class="ruby-comment"># skip</span>
      <span class="ruby-keyword">when</span> <span class="ruby-value">:on_comment</span>
        <span class="ruby-identifier">line</span> = <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]
        <span class="ruby-comment"># skip like `module Foo # :nodoc:`</span>
        <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">code_lines</span>[<span class="ruby-identifier">line</span>]
        <span class="ruby-identifier">body</span> = <span class="ruby-identifier">token</span>[<span class="ruby-value">2</span>][<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>

        <span class="ruby-identifier">body</span> = <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">empty?</span>

        <span class="ruby-identifier">comment</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Comment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">string:</span> <span class="ruby-identifier">body</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
        <span class="ruby-keyword">if</span> (<span class="ruby-identifier">prev_comment</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">line</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>])
          <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">line</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] = <span class="ruby-keyword">nil</span>
          <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">line</span>] = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Comment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">string:</span> <span class="ruby-identifier">prev_comment</span>.<span class="ruby-identifier">string</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">comment</span>.<span class="ruby-identifier">string</span>,
                                        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">line</span>] = <span class="ruby-identifier">comment</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">code_lines</span>[<span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]] = <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">process</span> <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractSyntaxTree</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">string</span>), <span class="ruby-value">decls:</span> <span class="ruby-identifier">source_decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-constant">Context</span>.<span class="ruby-identifier">initial</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-private" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">private</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="private-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 729</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">private</span>
  <span class="ruby-ivar">@private</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Private</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-process" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">process</span><span
                                class="method-args">(node, decls:, comments:, context:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="process-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 108</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">process</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">decls:</span>, <span class="ruby-value">comments:</span>, <span class="ruby-value">context:</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:CLASS</span>
    <span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">super_class_node</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">class_body</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
    <span class="ruby-identifier">super_class_name</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">super_class_node</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>)
    <span class="ruby-identifier">super_class</span> =
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">super_class_name</span>
        <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span><span class="ruby-operator">::</span><span class="ruby-constant">Super</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">super_class_name</span>, <span class="ruby-value">args:</span> [], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-comment"># Give up detect super class e.g. `class Foo &lt; Struct.new(:bar)`</span>
        <span class="ruby-keyword">nil</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">kls</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">const_to_name!</span>(<span class="ruby-identifier">class_name</span>),
      <span class="ruby-value">super_class:</span> <span class="ruby-identifier">super_class</span>,
      <span class="ruby-value">type_params:</span> [],
      <span class="ruby-value">members:</span> [],
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
    )

    <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">kls</span>

    <span class="ruby-identifier">new_ctx</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">enter_namespace</span>(<span class="ruby-identifier">kls</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_namespace</span>)
    <span class="ruby-identifier">each_node</span> <span class="ruby-identifier">class_body</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">process</span> <span class="ruby-identifier">child</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">kls</span>.<span class="ruby-identifier">members</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">new_ctx</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">remove_unnecessary_accessibility_methods!</span> <span class="ruby-identifier">kls</span>.<span class="ruby-identifier">members</span>
    <span class="ruby-identifier">sort_members!</span> <span class="ruby-identifier">kls</span>.<span class="ruby-identifier">members</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:MODULE</span>
    <span class="ruby-identifier">module_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">module_body</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>

    <span class="ruby-identifier">mod</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">const_to_name!</span>(<span class="ruby-identifier">module_name</span>),
      <span class="ruby-value">type_params:</span> [],
      <span class="ruby-value">self_types:</span> [],
      <span class="ruby-value">members:</span> [],
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
    )

    <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">mod</span>

    <span class="ruby-identifier">new_ctx</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">enter_namespace</span>(<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_namespace</span>)
    <span class="ruby-identifier">each_node</span> <span class="ruby-identifier">module_body</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">process</span> <span class="ruby-identifier">child</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">members</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">new_ctx</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">remove_unnecessary_accessibility_methods!</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">members</span>
    <span class="ruby-identifier">sort_members!</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">members</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:SCLASS</span>
    <span class="ruby-identifier">this</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">this</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:SELF</span>
      <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;`class &lt;&lt;` syntax with not-self may be compiled to incorrect code: #{this}&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">accessibility</span> = <span class="ruby-identifier">current_accessibility</span>(<span class="ruby-identifier">decls</span>)

    <span class="ruby-identifier">ctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">initial</span>.<span class="ruby-identifier">tap</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ctx</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">singleton</span> = <span class="ruby-keyword">true</span> }
    <span class="ruby-identifier">process_children</span>(<span class="ruby-identifier">body</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">ctx</span>)

    <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">accessibility</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:DEFN</span>, <span class="ruby-value">:DEFS</span>
    <span class="ruby-comment"># @type var kind: Context::method_kind</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:DEFN</span>
      <span class="ruby-identifier">def_name</span>, <span class="ruby-identifier">def_body</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
      <span class="ruby-identifier">kind</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">method_kind</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">_</span>, <span class="ruby-identifier">def_name</span>, <span class="ruby-identifier">def_body</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>
      <span class="ruby-identifier">kind</span> = <span class="ruby-value">:singleton</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">types</span> = [
      <span class="ruby-constant">MethodType</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">type_params:</span> [],
        <span class="ruby-value">type:</span> <span class="ruby-identifier">function_type_from_body</span>(<span class="ruby-identifier">def_body</span>, <span class="ruby-identifier">def_name</span>),
        <span class="ruby-value">block:</span> <span class="ruby-identifier">block_from_body</span>(<span class="ruby-identifier">def_body</span>),
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>
      )
    ]

    <span class="ruby-identifier">member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">def_name</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">overloads:</span> <span class="ruby-identifier">types</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">annotations:</span> [], <span class="ruby-value">method_type:</span> <span class="ruby-identifier">type</span> )},
      <span class="ruby-value">kind:</span> <span class="ruby-identifier">kind</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>],
      <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
      <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
    )

    <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">member</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">member</span>)

    <span class="ruby-identifier">new_ctx</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">singleton:</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:singleton</span>, <span class="ruby-value">in_def:</span> <span class="ruby-keyword">true</span>)
    <span class="ruby-identifier">each_node</span> <span class="ruby-identifier">def_body</span>.<span class="ruby-identifier">children</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">process</span> <span class="ruby-identifier">child</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">new_ctx</span>
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:ALIAS</span>
    <span class="ruby-identifier">new_name</span>, <span class="ruby-identifier">old_name</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">c</span>) }
    <span class="ruby-identifier">member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">new_name:</span> <span class="ruby-identifier">new_name</span>,
      <span class="ruby-value">old_name:</span> <span class="ruby-identifier">old_name</span>,
      <span class="ruby-value">kind:</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">singleton</span> <span class="ruby-operator">?</span> <span class="ruby-value">:singleton</span> <span class="ruby-operator">:</span> <span class="ruby-value">:instance</span>,
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>],
    )
    <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">member</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">member</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:FCALL</span>, <span class="ruby-value">:VCALL</span>
    <span class="ruby-comment"># Inside method definition cannot reach here.</span>
    <span class="ruby-identifier">args</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]&amp;.<span class="ruby-identifier">children</span> <span class="ruby-operator">||</span> []

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">when</span> <span class="ruby-value">:include</span>
      <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>))
          <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">singleton</span> <span class="ruby-operator">?</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Extend</span> <span class="ruby-operator">:</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Include</span>
          <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">args:</span> [],
            <span class="ruby-value">annotations:</span> [],
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:prepend</span>
      <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>))
          <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Prepend</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">args:</span> [],
            <span class="ruby-value">annotations:</span> [],
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:extend</span>
      <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>))
          <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Extend</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">args:</span> [],
            <span class="ruby-value">annotations:</span> [],
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:attr_reader</span>
      <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">arg</span>))
          <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrReader</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">ivar_name:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
            <span class="ruby-value">kind:</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">attribute_kind</span>,
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>],
            <span class="ruby-value">annotations:</span> []
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:attr_accessor</span>
      <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">arg</span>))
          <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrAccessor</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">ivar_name:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
            <span class="ruby-value">kind:</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">attribute_kind</span>,
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>],
            <span class="ruby-value">annotations:</span> []
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:attr_writer</span>
      <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">arg</span>))
          <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrWriter</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">ivar_name:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
            <span class="ruby-value">kind:</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">attribute_kind</span>,
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>],
            <span class="ruby-value">annotations:</span> []
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:alias_method</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">new_name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">old_name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]))
        <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">new_name:</span> <span class="ruby-identifier">new_name</span>,
          <span class="ruby-value">old_name:</span> <span class="ruby-identifier">old_name</span>,
          <span class="ruby-value">kind:</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">singleton</span> <span class="ruby-operator">?</span> <span class="ruby-value">:singleton</span> <span class="ruby-operator">:</span> <span class="ruby-value">:instance</span>,
          <span class="ruby-value">annotations:</span> [],
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>],
        )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:module_function</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
        <span class="ruby-identifier">context</span>.<span class="ruby-identifier">module_function</span> = <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">module_func_context</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">module_function:</span> <span class="ruby-keyword">true</span>)
        <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">arg</span>))
            <span class="ruby-keyword">if</span> (<span class="ruby-identifier">i</span>, <span class="ruby-identifier">defn</span> = <span class="ruby-identifier">find_def_index_by_name</span>(<span class="ruby-identifier">decls</span>, <span class="ruby-identifier">name</span>))
              <span class="ruby-keyword">if</span> <span class="ruby-identifier">defn</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>)
                <span class="ruby-identifier">decls</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-identifier">defn</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">kind:</span> <span class="ruby-value">:singleton_instance</span>)
              <span class="ruby-keyword">end</span>
            <span class="ruby-keyword">end</span>
          <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">arg</span>
            <span class="ruby-identifier">process</span> <span class="ruby-identifier">arg</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">module_func_context</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:public</span>, <span class="ruby-value">:private</span>
      <span class="ruby-identifier">accessibility</span> = <span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>])
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
        <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">accessibility</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">name</span> = <span class="ruby-identifier">literal_to_symbol</span>(<span class="ruby-identifier">arg</span>))
            <span class="ruby-keyword">if</span> (<span class="ruby-identifier">i</span>, <span class="ruby-identifier">_</span> = <span class="ruby-identifier">find_def_index_by_name</span>(<span class="ruby-identifier">decls</span>, <span class="ruby-identifier">name</span>))
              <span class="ruby-identifier">current</span> = <span class="ruby-identifier">current_accessibility</span>(<span class="ruby-identifier">decls</span>, <span class="ruby-identifier">i</span>)
              <span class="ruby-keyword">if</span> <span class="ruby-identifier">current</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">accessibility</span>
                <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">current</span>)
                <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">i</span>, <span class="ruby-identifier">accessibility</span>)
              <span class="ruby-keyword">end</span>
            <span class="ruby-keyword">end</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-comment"># For `private def foo` syntax</span>
        <span class="ruby-identifier">current</span> = <span class="ruby-identifier">current_accessibility</span>(<span class="ruby-identifier">decls</span>)
        <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">accessibility</span>
        <span class="ruby-identifier">process_children</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>)
        <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">current</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">process_children</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>)
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:ITER</span>
    <span class="ruby-identifier">method_name</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">method_name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:refine</span>
      <span class="ruby-comment"># ignore</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">process_children</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>)
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:CDECL</span>
    <span class="ruby-identifier">const_name</span> = <span class="ruby-keyword">case</span>
                 <span class="ruby-keyword">when</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
                   <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>)
                 <span class="ruby-keyword">else</span>
                   <span class="ruby-identifier">const_to_name!</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>])
                 <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">value_node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>
    <span class="ruby-identifier">type</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">value_node</span>.<span class="ruby-identifier">nil?</span>
            <span class="ruby-comment"># Give up type prediction when node is MASGN.</span>
            <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
          <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">literal_to_type</span>(<span class="ruby-identifier">value_node</span>)
          <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Constant</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">const_name</span>,
      <span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
    )

  <span class="ruby-keyword">when</span> <span class="ruby-value">:IASGN</span>
    <span class="ruby-keyword">case</span> [<span class="ruby-identifier">context</span>.<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">context</span>.<span class="ruby-identifier">in_def</span>]
    <span class="ruby-keyword">when</span> [<span class="ruby-keyword">true</span>, <span class="ruby-keyword">true</span>], [<span class="ruby-keyword">false</span>, <span class="ruby-keyword">false</span>]
      <span class="ruby-identifier">member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstanceVariable</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span>,
        <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
      )
    <span class="ruby-keyword">when</span> [<span class="ruby-keyword">false</span>, <span class="ruby-keyword">true</span>]
      <span class="ruby-identifier">member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceVariable</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span>,
        <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
      )
    <span class="ruby-keyword">when</span> [<span class="ruby-keyword">true</span>, <span class="ruby-keyword">false</span>]
      <span class="ruby-comment"># The variable is for the singleton class of the class object.</span>
      <span class="ruby-comment"># RBS does not have a way to represent it. So we ignore it.</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;unreachable&#39;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">member</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">member</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">decls</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">member</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:CVASGN</span>
    <span class="ruby-identifier">member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassVariable</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">first</span>,
      <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
    )
    <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">member</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">member</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">process_children</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-process_children" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">process_children</span><span
                                class="method-args">(node, decls:, comments:, context:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="process_children-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 433</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">process_children</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">decls:</span>, <span class="ruby-value">comments:</span>, <span class="ruby-value">context:</span>)
  <span class="ruby-identifier">each_child</span> <span class="ruby-identifier">node</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">process</span> <span class="ruby-identifier">child</span>, <span class="ruby-value">decls:</span> <span class="ruby-identifier">decls</span>, <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>, <span class="ruby-value">context:</span> <span class="ruby-identifier">context</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-public" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">public</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="public-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 733</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">public</span>
  <span class="ruby-ivar">@public</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Public</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-range_element_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">range_element_type</span><span
                                class="method-args">(types)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="range_element_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 674</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">range_element_type</span>(<span class="ruby-identifier">types</span>)
  <span class="ruby-identifier">types</span> = <span class="ruby-identifier">types</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">untyped</span> }
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">untyped</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">types</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">types</span> = <span class="ruby-identifier">types</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>)
      <span class="ruby-identifier">type_name</span> = <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">literal</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">root</span>)
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">type_name</span>, <span class="ruby-value">args:</span> [], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">t</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>.<span class="ruby-identifier">uniq</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">types</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">types</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">untyped</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-remove_unnecessary_accessibility_methods-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">remove_unnecessary_accessibility_methods!</span><span
                                class="method-args">(decls)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="remove_unnecessary_accessibility_methods-21-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 747</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">remove_unnecessary_accessibility_methods!</span>(<span class="ruby-identifier">decls</span>)
  <span class="ruby-comment"># @type var current: decl</span>
  <span class="ruby-identifier">current</span> = <span class="ruby-identifier">public</span>
  <span class="ruby-identifier">idx</span> = <span class="ruby-value">0</span>

  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">decl</span> = <span class="ruby-identifier">decls</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-keyword">or</span> <span class="ruby-keyword">break</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">current</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">decl</span>
      <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">idx</span>)
      <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">if</span> <span class="ruby-value">0</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">idx</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">is_accessibility?</span>(<span class="ruby-identifier">decls</span>[<span class="ruby-identifier">idx</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">is_accessibility?</span>(<span class="ruby-identifier">decl</span>)
      <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">idx</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
      <span class="ruby-identifier">idx</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
      <span class="ruby-identifier">current</span> = <span class="ruby-identifier">current_accessibility</span>(<span class="ruby-identifier">decls</span>, <span class="ruby-identifier">idx</span>)
      <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">current</span> = <span class="ruby-identifier">decl</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">is_accessibility?</span>(<span class="ruby-identifier">decl</span>)
    <span class="ruby-identifier">idx</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">is_accessibility?</span>(<span class="ruby-identifier">decls</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">raise</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-sort_members-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sort_members!</span><span
                                class="method-args">(decls)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="sort_members-21-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 795</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sort_members!</span>(<span class="ruby-identifier">decls</span>)
  <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">orders</span> = {
    <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassVariable</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">-3</span>,
    <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstanceVariable</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">-2</span>,
    <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceVariable</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">-1</span>,
  }
  <span class="ruby-identifier">decls</span>.<span class="ruby-identifier">sort_by!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">orders</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">decl</span>.<span class="ruby-identifier">class</span>, <span class="ruby-value">0</span>), <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>] }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-types_to_union_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">types_to_union_type</span><span
                                class="method-args">(types)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="types_to_union_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rb.rb, line 663</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">types_to_union_type</span>(<span class="ruby-identifier">types</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">untyped</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">types</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">uniq</span> = <span class="ruby-identifier">types</span>.<span class="ruby-identifier">uniq</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Union</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">types:</span> <span class="ruby-identifier">uniq</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

